package com.okaixz.client.controller;


import com.okaixz.client.model.domain.KbAssistant;
import com.okaixz.client.model.domain.KbUserAssistantInfo;
import com.okaixz.client.model.dto.KbUserAssistantAddAllDto;
import com.okaixz.client.service.IKbUserAssistantInfoNewService;
import com.okaixz.client.service.IKbUserAssistantInfoService;
import com.okaixz.common.client.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author cdz
 * @since 2025-11-10
 */
@RestController
@RequestMapping("/kb/userAssistantNew")
public class KbUserAssistantInfoNewController {
    @Autowired
    private IKbUserAssistantInfoNewService kbUserAssistantInfoService;
    @PostMapping("/list")
    public Result<List<KbAssistant>> getListbyUserId(){
        List<KbAssistant> list = kbUserAssistantInfoService.getAssistantByUserIdAndSex();
        return Result.success(list);
    }
    @PostMapping("/add")
    public Result<KbAssistant> add(Integer type,Long id){
        KbAssistant list = kbUserAssistantInfoService.addAssistant(id,type);
        return Result.success(list);
    }

    @PostMapping("/updateByIds")
    public Result<List<KbAssistant>> updateByIds(@RequestBody List< Long> ids){
        List<KbAssistant> resutlList = kbUserAssistantInfoService.saveOrUpdateByUserIdAndSex(ids);
        return Result.success(resutlList);
    }

}
